﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;
using Nancy.Responses;
using API_Service.BizLogic.Platform;

namespace API_Service.Module
{
    public class PlatformModule : BaseAPIModule
    {
        PlatformService  platformService = new PlatformService();
        public PlatformModule() : base("/platform")
        {
            Post["/update/password"] = p =>
            {
                string userid = Request.Form["UserID"];
                string newpassowrd = Request.Form["NewPassword"];

                ExecutionResult model = platformService.UpdatePassowrd(userid, newpassowrd);

                return Response.AsJson(model);
            };

            Get["/pda/menu/{userid}"] = p =>
            {
                return Response.AsJson(platformService.GetPDAMenuList((string)p.userid));
            };

            Get["/win/menu/{userid}"] = p =>
            {
                return Response.AsJson(platformService.GetWINMenuList((string)p.userid));
            };
        }
    }
}